package com.yang.designmode.ActionMode.mediator;

// 使用示例
public class Client {
    public static void main(String[] args) {
        // 创建中介者
        ConcreteMediator mediator = new ConcreteMediator();
        // 创建两个同事 A B 并关联到中介者
        ColleagueA colleagueA = new ColleagueA(mediator);
        ColleagueB colleagueB = new ColleagueB(mediator);
        // 中介者添加两个同事
        mediator.setColleagueA(colleagueA);
        mediator.setColleagueB(colleagueB);
        // 发送消息
        colleagueA.send("Hello from ColleagueA");
        colleagueB.send("Hi from ColleagueB");
    }
}